<?php
/**
 * Created by PhpStorm.
 * User: lscm
 * Date: 14-8-6
 * Time: 下午4:38
 */
require("common/dbutil.php");
//$dbServer = "localhost";
//$dbUser = "adsAdmin";
//$dbPassword = "";
//$dbName = "surfingHelper";
$con=\common\dbutil::getConnect();
mysqli_set_charset($con,"utf8");
$result = mysqli_query($con,"SELECT * FROM ads WHERE AD_CATEGORY='1'");//3c:AD_CATEGORY='1'
$ad_category = "3c";
require("head.php");
function buildItem($data){
    $html = '<li class="good-item">'.
        '<a href="'.$data[ad_target_url].'" target="_blank"><img src="'.$data[ad_material_urls].'"></a>'.
        '<br>'.
        '<a href="'.$data[ad_target_url].'" class="good-title" target="_blank">'.$data[ad_title].'</a>'.
        '<div>'.
        '<span>'.$data[ad_price].'</span>'.
        '</div>'.
        '</li>';
    return $html;
}
echo("<body>");
require("header.php");
?>
<div class="container">
    <div class="main-content">
        <ul>
            <?php
            for ($i=0; $data = $result->fetch_array(MYSQLI_ASSOC);$i++){
                echo buildItem($data);
            }
            ?>
        </ul>

    </div>
</div>
</body>
</html>